$(document).ready(function(){
    /*hoangnm*/
    var locationTopForm=$("#LocationTopForm");
    if(locationTopForm.length> 0) {
        if (locationTopForm.find(".module-slide-lst-hotel").length == 0) {
            locationTopForm.parents(".col2-panel").hide();
        }

    }
    // paging for all
    $("#sys-wrap-lst-hotel-paging").on("click",'.sys-paging-location',function(){
        var page = $(this).attr('data-page');
        var locationId = $('#sys-location-id').val();
        var star = $(this).attr('data-star');
        if(star == undefined || star == null ){
            star =0;
        }
        jQuery.post(WEB_DIR+"ajax.php?act=locationpage&code=paging_location", {
                page: page,
                locationId :locationId,
                star:star
            },
            function(msg){
                if(msg.type == 1){
                    $("#sys-wrap-lst-hotel-paging").html(msg.item);
                    /*$('.sys-lst-likes-hotel').remove();
                     $('.sys-paging-location-hotel').before(msg.item);*/
                }else if(msg.type == 0){
                }
                $('.sys-paging-location').attr('data-star',star);
            },'json');
    });

    // list hotel by star
    $("#sys-wrap-lst-hotel-paging,#sys-wrap-lst-hotel").on("click",'.sys-lst-hotel-star',function(){
        var star = $(this).attr('data-star');
        var locationId = $('#sys-location-id').val();
        jQuery.post(WEB_DIR+"ajax.php?act=locationpage&code=hotel_star_location", {
                page: 1,
                locationId :locationId,
                star:star
            },
            function(msg){
                $('.sys-lst-hotel-star').removeClass('active');
                $("#sys-tab-"+star).addClass('active');

                if(msg.type == 1){
                    $("#sys-wrap-lst-hotel-paging").html(msg.item);
                }else if(msg.type == 0){

                }
                $('.sys-paging-location').attr('data-star',star);
            },'json');
    });

});

